<?php
$forward = $mvc->getObject('forward');
if (isset($forward)){
?>
	<span class="message warning"><?php echo $forward;?></span>
<?php } ?>
<?php
	$list = $mvc->getObject('list');
	if(!isset($list) || count($list) == 0){
?>
<span class="message warning">
	Oops... seems the address you have entered is invalid. There are no schools for such criterias.<br />
	But you may still find some schools of interest by browsing our <a href="/schools.html" title="Schools">Schools</a> directory.
</span>
<?php } else { ?>
<div class="pgListItem wide">
		<h1><?php echo $list[SchoolService::CAPTION];?></h1>
		<div class="pgItemImg">
			<img src="<?php echo $list[SchoolService::AVATAR];?>" alt="" title="" />
		</div>
		<div class="pgItemBody" style="display:table">
			<ul>
				<li>
					<span>Rating:</span>
					<span class="lsValue">
						<a href="?valuate=1&id=<?php echo $list[SchoolService::ID] ?>"><?php if($list[SchoolService::RATE] >= 1){ ?>
							<img src="images/star.png" /><?php }else{ ?><img src="images/gray-star.png" /><?php } ?>
						</a>
						<a href="?valuate=2&id=<?php echo $list[SchoolService::ID] ?>"><?php if($list[SchoolService::RATE] >= 2){ ?>
							<img src="images/star.png" /><?php }else{ ?><img src="images/gray-star.png" /><?php } ?>
						</a>
						<a href="?valuate=3&id=<?php echo $list[SchoolService::ID] ?>"><?php if($list[SchoolService::RATE] >= 3){ ?>
							<img src="images/star.png" /><?php }else{ ?><img src="images/gray-star.png" /><?php } ?>
						</a>
						<a href="?valuate=4&id=<?php echo $list[SchoolService::ID] ?>"><?php if($list[SchoolService::RATE] >= 4){ ?>
							<img src="images/star.png" /><?php }else{ ?><img src="images/gray-star.png" /><?php } ?>
						</a>
						<a href="?valuate=5&id=<?php echo $list[SchoolService::ID] ?>"><?php if($list[SchoolService::RATE] >= 5){ ?>
							<img src="images/star.png" /><?php }else{ ?><img src="images/gray-star.png" /><?php } ?>
						</a>
					</span>
					<span class="lsValue rate">
						<?php echo $list[SchoolService::RATE]?>/<?php echo $list[SchoolService::NUMBER_RATE]?>
					</span>
				</li>
				<li><span>Students:</span><span class="lsValue"><?php echo $list[SchoolService::CNT_STUDENTS];?></span></li>
				<li><span>Courses:</span><span class="lsValue"><?php echo $list[SchoolService::CNT_COURSES];?></span></li>
				<li><span>Language:</span><span class="lsValue"><?php echo $list[SchoolService::LANGUAGE];?></span></li>
				<li><span>Base fee:</span><span class="lsValue"><?php echo $list[SchoolService::BASE_FEE];?>$ / mon</span></li>
				<li><span>Categories:</span>
					<span class="lsValue">
					<?php if (isset($list['subject'])){ 
							foreach($list['subject'] as $key_sub => $subject){ ?>
							<a href="/courses.html?cat=<?php echo $subject[CategoriesService::NAME];?>">
							<?php echo $subject[CategoriesService::NAME]; ?></a>
						<? } 
						}?>
					</span>
				</li>
		     	<?php $assign = $mvc->getObject('assign'); if(!isset($assign) || count($assign) == 0){?>
		     	<li><span>Status:</span><span><a class="button" href="<?php echo "/school-assigned.html?signup=" . $list[SchoolService::ID] ?>">SignUp</a></span></li>
				<?php } else { ?>
				<li><span>Status:</span><span><a class="button" href="<?php echo "/school-assigned.html?signout=" . $list[SchoolService::ID] ?>">SignOut</a></span></li>
		   		<?php } ?>
			</ul>
		   		
		   		<form action="https://www.paypal.com/cgi-bin/webscr" method="post"> 
		   		<input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="upload" value="1"> 
		   		<input type="hidden" name="business" value="seller@designerfotos.com"> 
		   		<input type="hidden" name="item_name_1" value="<?php echo $list[SchoolService::CAPTION];?>"> 
		   		<input type="hidden" name="amount_1" value="1.00"> 
		   		<input type="submit" class="defBtn" value="pay with PayPal"> 
		   		</form>
		   		
			<p class="extLink"><?php echo  $list[SchoolService::DESCRIPTION];?></p>
		</div>	
</div>
<div class="subHeader">
	<b>Courses Available:</b>
</div>
<div>
<?php
	$courseslist = $mvc->getObject('courselist');
	if(!isset($courseslist) || count($courseslist) == 0){
?>
<span class="message warning">
	Sorry, there are no school courses available at this moment.<br />
	Please visit our school later. It will be updated very soon.
</span>
<?php } else { ?>
<?php foreach($courseslist as $key => $value){ ?>
<div class="pgListItem wide">
    <h2>
		<a href="<?php echo "/course-details.html?id=" . $value[CourseService::ID] ?>">
			<?php echo $value[CourseService::CAPTION];?>
		</a>
	</h2>
	<div class="pgItemImg">
		<a href="<?php echo "/course-details.html?id=" . $value[CourseService::ID] ?>"><img src="<?php echo $value[CourseService::AVATAR];?>" alt="" title="" /></a>
	</div>
	<div class="pgItemBody">
		<ul>
			<li><span>Rating:</span>
			<span class="lsValue">
				<a href="?valuate=1&id=<?php echo $mvc->getParam('id');?>&course_id=<?php echo $value[CourseService::ID] ?>"><?php if($value[CourseService::RATE] >= 1){ ?>
					<img src="images/star.png" /><?php }else{ ?><img src="images/gray-star.png" /><?php } ?>
				</a>
				<a href="?valuate=2&id=<?php echo $mvc->getParam('id');?>&course_id=<?php echo $value[CourseService::ID] ?>"><?php if($value[CourseService::RATE] >= 2){ ?>
					<img src="images/star.png" /><?php }else{ ?><img src="images/gray-star.png" /><?php } ?>
				</a>
				<a href="?valuate=3&id=<?php echo $mvc->getParam('id');?>&course_id=<?php echo $value[CourseService::ID] ?>"><?php if($value[CourseService::RATE] >= 3){ ?>
					<img src="images/star.png" /><?php }else{ ?><img src="images/gray-star.png" /><?php } ?>
				</a>
				<a href="?valuate=4&id=<?php echo $mvc->getParam('id');?>&course_id=<?php echo $value[CourseService::ID] ?>"><?php if($value[CourseService::RATE] >= 4){ ?>
					<img src="images/star.png" /><?php }else{ ?><img src="images/gray-star.png" /><?php } ?>
				</a>
				<a href="?valuate=5&id=<?php echo $mvc->getParam('id');?>&course_id=<?php echo $value[CourseService::ID] ?>"><?php if($value[CourseService::RATE] >= 5){ ?>
					<img src="images/star.png" /><?php }else{ ?><img src="images/gray-star.png" /><?php } ?>
				</a>
			</span>
			<span class="lsValue rate">
				<?php echo $value[CourseService::RATE]?>/<?php echo $value[CourseService::NUMBER_RATE]?>
			</span>
			</li>
		</ul>
		<p class="extLink">
			<?php echo $value[CourseService::DESCRIPTION];?>
			<a href="<?php echo 'course-details.html?id=' . $value[CourseService::ID];?>" title="View">More...</a>
		</p>
	</div>
</div>
<div class="clnr brdr">&nbsp;</div>
<?php } } ?>
</div>
<?php } ?>
